<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath(); //  path = "/travel"
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/bgMusic/"; // basePath="http://localhost:8080/travel/"
%>
<html>
<head>
    <title>${sessionScope.title}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/layui-v2.2.5/layui/css/layui.css" media="all">
    <script src="/layui-v2.2.5/layui/layui.js" charset="utf-8"></script>
    <script src="/js/pictureCompress.js" charset="utf-8"></script>

    <style type="text/css">
        .layui-form-item{
            margin-left: 20px;
            margin-top: 1%;
        }
        .layui-form-label{
            width: 130px;
        }
    </style>
</head>
<body>
<form  id="jsForm" action="/adminSystem/createBaseInfo" method="post" enctype ="multipart/form-data">
    <div class="layui-form-item" style="display: none">
        <label class="layui-form-label">机构名称</label>
        <div class="layui-input-inline">
            <input type="text" name="orgName" id="orgName" lay-verify="required" placeholder="请输入机构名称" autocomplete="off" class="layui-input" value="${returnData.orgName}">
        </div>
   <%-- </div>
    <div class="layui-form-item">--%>
        <label class="layui-form-label">客服电话</label>
        <div class="layui-input-inline">
            <input type="text" name="serviceTel" id="serviceTel" lay-verify="required" placeholder="请客服电话" autocomplete="off" class="layui-input" value="${returnData.serviceTel}">
        </div>

    </div>
    <div class="layui-form-item" style="display: none">
        <%--<label class="layui-form-label">负责人电话</label>
        <div class="layui-input-inline">
            <input type="text" name="principalTel" id="principalTel" lay-verify="required|phone" placeholder="请输入手机号" autocomplete="off" maxlength="11" class="layui-input" value="${returnData.principalTel}">
        </div>--%>

                <label class="layui-form-label">公司地址</label>
                <div class="layui-input-inline">
                    <input type="text" name="address" id="address" lay-verify="required" autocomplete="off" placeholder="请公司地址" class="layui-input" value="${returnData.address}">
                </div>
   <%-- </div>
    <div class="layui-form-item">--%>
        <label class="layui-form-label">合作方</label>
        <div class="layui-input-inline">
            <input type="text" name="agent" id="agent" lay-verify="required" placeholder="请输入合作方" autocomplete="off" class="layui-input" value="${returnData4.agent}">
        </div>
    </div>

    <div class="layui-form-item" style="margin-top:1%">
    <label class="layui-form-label" title="上传背景音乐">上传背景音乐</label>
    <div class="layui-input-inline">
        <input type="file" name="bgMusic" accept="audio/mpeg" class="layui-input" id="bgMusic" />
    </div>
        <div class="layui-input-inline" style="margin-left: 20px">
        <audio controls="controls">
            <c:if test="${returnData.bgMusicPath!=null}">
                <source src="${returnData.bgMusicPath}" type="audio/mpeg">
            </c:if>
            <c:if test="${empty returnData.bgMusicPath}">
                <source src="<%=basePath%>Lenka - The Show.mp3" type="audio/mpeg">
            </c:if>
        </audio>
        </div>
    </div>

 <%--   <div class="layui-form-item">
        <label class="layui-form-label">效果图1</label>
        <div class="layui-input-inline">
            <img src="${returnData2[0].path}" width="300px" height="150px">
        </div>

            <label class="layui-form-label" style="margin-left: 15%">效果图2</label>
            <div class="layui-input-inline">
                <img src="${returnData3[0].path}" width="300px" height="150px">
            </div>

    </div>--%>

     <button class="layui-btn" style="margin-left: 48%"  type="submit">立即提交</button>
    <%-- <button class="layui-btn" style="margin-left: 48%" id="btn" type="button">立即提交</button>--%>
    <input type="hidden" name="agentId" value="${returnData.agentId}" id="agentId">
    <input type="hidden" name="id" value="${returnData.id}" id="orgId">
</form>
</body>
</html>

<script src="/admin/js/jquery.min.js" charset="utf-8"></script>

<script>
    $(function () {
        var form = new FormData(document.getElementById("jsForm"));
        $("#btn").click(function () {
            $("#jsForm").ajaxSubmit();
           /* $.ajax({
                url:'/adminSystem/createBaseInfo',
                type:'POST',
                processData:false,
                contentType:false,
                data: form,
                success:function(data){

                }
            });*/
        })
    })
    layui.use(['form', 'layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //监听提交
        form.on('submit(updateAgent)', function(){
            var orgName = $("#orgName").val();
            var principal = $("#principal").val();
            var principalTel = $("#principalTel").val();
            var serviceTel = $("#serviceTel").val();
            var address = $("#address").val();
            var agentId = $("#agentId").val();
            var orgId=$("#orgId").val();
            var bgMusic=document.getElementById("bgMusic").files[0];


            return false;
        });
    });
</script>